package com.easylinkin.linkappapi.devicemanager.controller;

import com.baomidou.mybatisplus.extension.api.ApiController;
import com.easylinkin.linkappapi.common.model.RequestModel;
import com.easylinkin.linkappapi.devicemanager.service.SensorService;
import com.easylinkin.linkappapi.devicemanager.vo.WireropeVo;
import org.springframework.web.bind.annotation.*;
import site.morn.rest.RestBuilders;
import site.morn.rest.RestMessage;

import javax.annotation.Resource;

/**
 * @author linWenLe
 * @Date: 2024/3/28
 * @Description: 标养室传感器
 */
@RestController
@RequestMapping("/sensor")
public class SensorController extends ApiController {

    @Resource
    private SensorService sensorService;

    /***
     * 设备检测获取温度、湿度、水位、电流
     * @return
     */
    @GetMapping("sensorMonitoring")
    public RestMessage sensorMonitoring() {
        return  RestBuilders.successBuilder(sensorService.sensorMonitoring()).build();
    }

    /***
     * 预警记录
     * @return
     */
    @PostMapping("sensorAlertHistory")
    public RestMessage sensorAlertHistory(@RequestBody RequestModel<WireropeVo> restPage) {
        return  RestBuilders.successBuilder(sensorService.sensorAlertHistory(restPage)).build();
    }

    /***
     * 传感器检测数据
     * @return
     */
    @PostMapping("sensorDataList")
    public RestMessage sensorDataList(@RequestBody WireropeVo entity) {
        return  RestBuilders.successBuilder(sensorService.sensorDataList(entity)).build();
    }
}
